﻿using System;
using System.Diagnostics;
using Xunit;

namespace MyDemo.ExamSubject
{
    /// <summary>
    /// 面试题1
    /// </summary>
    public class Subject1
    {
        [Fact]
        public void Test()
        {
            A a = new B();
            a.Fun();
        }

        public abstract class A
        {
            public A()
            {
                Debug.WriteLine("A");
            }

            public virtual void Fun()
            {
                Debug.WriteLine("A.Fun()");
            }
        }

        public class B : A
        {
            public B()
            {
                Debug.WriteLine("B");
            }

            public new void Fun()
            {
                Debug.WriteLine("B.Fun()");
            }
        }
    }

}